Murphy's Law: Anything that can go wrong will go wrong.
Three months. Ninety days. Twenty-one hundred and sixty-one hours. One
hundred twenty-nine thousand six hundred minutes. Aka 7,776,000 seconds of continuous
code execution before I found out that there was one (1) error(s) in my code.
Unfortunately, I can re-execute the entire code once again. "But", I tell myself
smiling with crooked toes, "I will never forget the importance of using the correct
data types again!"
Programming is based on a simple concept: The computer does exactly what
you tell it to do. However, it is not as easy as just asking Siri, Google or Alexa
a simple question. But if we cannot talk, how can we get a computer to do something
for us?
As programmers, we write a finite set of instructions to go from an initial state
towards a final goal. These instructions are referred to as an algorithm or program
and are written in a simple text editor. A general text editor that many use is Microsoft
Word. However, this is not recommended for writing programs! I personally use the
PyCharm and the BBEdit text editor. Unfortunately, just writing a simple instruction
is not enough. To be able to communicate with a computer, we have to write it in a
specific language. A computer understands as much about a proper English text as I
understand the Hebrew language, which is nothing. Just as we have many different
languages in this world, there are also several languages available for computers.
Common and widely used languages are Python, Java(Script), C(++) and R. I typically
write programmes in Python programming language and in a somewhat older language,
called Fortran.
Well, and then what? We have the instructions, but how do we give those to the computer?
When programming in Python this is extremely simple. Python code is interpreted directly
by a Python interpreter that we use to run the program. Other languages require a compiler.
A compiler is a programme that converts the programming language into machine code,
which can then be executed directly by the computer's processor. Since there is no
extra interpreter between the code and its execution, working with a compiled code is much faster.
So why do we not all work with compiled codes. Well, writing this compiled code is a
bit more complicated. For example, at the beginning of each program, you have to specify
the type of each individual variable (string, integer, float) and you have to specify
the amount of memory you are going to use for storing these variables. In addition,
we can not actually read compiled code: Only the code that the compiler compiles is
human readable.
"Every advantage has its disadvantage", I think that a knowledge of several languages
will always come in handy. Just like in this world, you never know what you can
expect and where you will end up but you always want to be a little bit ahead of the game.